package com.dynabook.ems.model.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Positive;
import java.util.List;

/**
 * 工单选择样品请求DTO
 */
@Data
@ApiModel(value = "工单选择样品请求", description = "新建工单时选择样品的请求参数")
public class WorkOrderSelectSampleRequest {
    
    @ApiModelProperty(value = "工单号", example = "WO202501001", required = true)
    @NotBlank(message = "工单号不能为空")
    private String workOrderNumber;

//    @ApiModelProperty(value = "成品型号",required = true)
//    private String productName;
//    /**
//     * 成品名称
//     */
//    @ApiModelProperty(value = "成品名称",required = true)
//    private String finishProductName;
//
//    @ApiModelProperty(value = "生产数量",required = true)
//    private Integer productionQuantity;
//
//    @ApiModelProperty(value = "机型名称",required = true)
//    private String machineName;
//
    @ApiModelProperty(value = "需求总数", example = "10", required = true)
    @NotNull(message = "需求总数不能为空")
    @Positive(message = "需求总数必须大于0")
    private Integer totalNum;

    @ApiModelProperty(value = "工单详情ID", example = "123", required = true)
    @NotNull(message = "工单详情ID不能为空")
    private Long detailId;
    
    @ApiModelProperty(value = "选择的样品列表", required = true)
    @NotEmpty(message = "样品列表不能为空")
    @Valid
    private List<SampleSelectItem> sampleList;
    /**
     * 样品选择项
     */
    @Data
    @ApiModel(value = "样品选择项", description = "单个样品的选择信息")
    public static class SampleSelectItem {


        @ApiModelProperty(value = "样机编号", example = "GDM460010306", required = true)
        @NotBlank(message = "样机编号不能为空")
        private String fixedNo;

        
        @ApiModelProperty(value = "借用数量", example = "5", required = true)
        @NotNull(message = "借用数量不能为空")
        @Positive(message = "借用数量必须大于0")
        private Integer borrowNum;
        
        @ApiModelProperty(value = "样品类型：0-在库样品，1-本人已借样品", example = "0", required = true)
        @NotNull(message = "样品类型不能为空")
        private Integer type;

        @ApiModelProperty(value = "请求id(只有在type传1的时候需要传,type为0 传空)", example = "R2025070001")
        private String emsRequestId;
    }
}